# from flask import logging
import logging

from redis import StrictRedis
class Config(object):
    """1,项目的配置"""
    DEBUG = True
    # 随机码
    SECERT_KEY = 'r45RmSIIw9O/XY6s6HzgMmPf1loC8OWPrLYxIgNtHXI+RoZNXETyx7YQ1yfPVa8b'
    # 5,为mysql添加配置
    SQLALCHEMY_DATABASE_URI = "mysql://root:mysql@127.0.0.1:3306/information"
    SQLALCHEMY_TRACK_MODIFICATIONS = False
    # 7,redis配置
    REDIS_HOST = '127.0.0.1'
    REDIS_PORT = 6379
    # session保存位置
    SESSION_TYPE = "redis"
    # 开启session签名
    SESSION_USE_SIGNER = True
    # 指定session保存的redis
    SESSION_REDIS = StrictRedis(host=REDIS_HOST,port=REDIS_PORT)
    # 设置需要过期
    SESSION_PERMANENT = False
    # 设置过期时间:2天
    PERMANENT_SESSION_LIFETIME = 86400*2

    # 设置日记等级
    LOG_LEVEL = logging.DEBUG

class DevelopementConfig(Config):
    """开发模式下的配置"""
    DEBUG = True


class ProductionConfig(Config):
    """生产模式下的配置"""
    DEBUG = False
    LOG_LEVEL = logging.ERROR


class TestingConfig(Config):
    """单元测试环境下的配置"""
    DEBUG = True
    TESTING = True


# 定义配置字典
config = {
    "development": DevelopementConfig,
    "production": ProductionConfig,
    "testing": TestingConfig
}